<?php

namespace Modules\Car\Entities;

use App\Models\Car;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class ChangeSeries extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    protected static function newFactory()
    {
        return \Modules\Car\Database\factories\ChangeSeriesFactory::new();
    }
    public function oldCar(){
        return $this->hasOne(Car::class,'id','old');
    }
    public function newCar(){
        return $this->hasOne(Car::class,'id','new');
    }
}
